﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using BluePortal.Framework;
using BluePortal.Medias.Core;

namespace BluePortal.Medias.Services.Soap
{
    [ServiceContract(Namespace = "BluePortal.Medias.Services.Soap")]
    public interface IMediaService
    {
        BluePortal.Framework.FindResult<Media> FindAll(BluePortal.Framework.FindParameters findParameters);
    }

    public class MediaService : IMediaService
    {
        private BCMedia service = new BCMedia();

        #region IVideoService Members

        public FindResult<Media> FindAll(FindParameters findparameter)
        {
            FindResult<Media> videos = service.FindAll(findparameter);
            return videos;
        }

        public FindResult<Media> FindByPlayList(Guid plid, FindParameters findParameters)
        {
            return service.FindByPlayList(plid, findParameters);
        }

        public FindResult<Media> FindByCategory(Guid cid, FindParameters findParameters)
        {
            return service.FindByCategory(cid, findParameters);
        }

        public FindResult<Media> FindByTag(string tag, FindParameters findParameters)
        {
            return service.FindByTag(tag, findParameters);
        }

        public IEnumerable<Media> FindTopRating(string loginName, int count)
        {
            return service.FindTopRating(loginName, count);
        }

        public IEnumerable<Media> FindLastUpload(string loginName, int count)
        {
            return service.FindLastUpload(loginName, count);
        }

        public IEnumerable<Media> FindTopContributor(string loginName, int count)
        {
            return service.FindTopContributor(loginName, count);
        }

        public IEnumerable<Media> FindTopView(string loginName, int count)
        {
            return service.FindTopView(loginName, count);
        }

        public FindResult<Media> FindAllByUserWithViewCount(string loginName, FindParameters findParameters)
        {
            return service.FindAllByUserWithViewCount(loginName, findParameters);
        }

        public FindResult<Media> FindByChannelWithViewCount(string loginName, Guid chid, FindParameters findParameters)
        {
            return service.FindByChannelWithViewCount(loginName, chid, findParameters);
        }

        public Media FindOrDefault(Guid vid)
        {
            return service.FindByID(vid);
        }

        public void AddRating(Guid vid, string loginName, int ratingValue)
        {
           service.AddRating(vid, loginName, ratingValue);
        }

        public int FindUserRating(Guid vid, string loginName)
        {
            return service.FindUserRating(vid, loginName);
        }
        
        public void AddView(Guid vid, string loginName)
        {
            service.AddView(vid, loginName);
        }

        public void Delete(Guid id)
        {
            service.Delete(id);
        }
      
        public Media FindByID(Guid id)
        {
            return service.FindByID(id);
        }


        #endregion        
    }
}
